package adv5;

import java.io.*;

/**
 * @author oldliu
 * @since 1.0
 */
public class WriteObject {
    public static void main(String[] args) {
        try {
//            ObjectOutputStream out=new ObjectOutputStream(new FileOutputStream("d:/tmp/ren.obj"));
//            Person p=new Person("马超",19,"唱跳rap和篮球");
//            out.writeObject(p);
//            out.close();
            ObjectInputStream oin=new ObjectInputStream(new FileInputStream("d:/tmp/ren.obj"));
            Person o = (Person)oin.readObject();
            oin.close();
            System.out.println("读取的对象是："+o);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
